﻿using Microsoft.AspNetCore.Mvc;
using WorldmeServer.DTO.用户相关;
using WorldmeServer.Services.Business.材质相关;
using WorldmeServer.Services.Business.用户相关;

namespace WorldmeServer.Controllers.用户相关
{
    [ApiController]
    [Route("api/users")]
    public class UserController : ControllerBase
    {
        private UserService userService;

        public UserController(UserService userService)
        {
            this.userService = userService;
        }

        [HttpGet]
        [Route("get/{id}")]
        public async Task<IActionResult> Get(string id)
        {
            var result = await userService.GetUser(id);
            if (!result.IsSuccess)
                return BadRequest(result.Message);
            return Ok(result.Data);
        }

        [HttpPut]
        [Route("update")]
        public async Task<IActionResult> Update([FromBody] UpdateUserDTO dto)
        {

            return Ok(dto);
        }

    }
}
